<template>
  <div class="app-container">
  <el-table v-loading="loading" :data="mailRecordList">
    <el-table-column label="发件人" prop="sendAddress" :show-overflow-tooltip="true" width="400" align="center" />
    <el-table-column label="客户收件人" prop="receiveAddress" :show-overflow-tooltip="true" width="400" align="center" />
    <el-table-column label="邮件主题" prop="mailTitle" width="430" align="center" :show-overflow-tooltip="true" />
    <el-table-column label="发送时间" prop="sendTime" width="450" align="center" :show-overflow-tooltip="true" />
  </el-table>

  <pagination
    v-show="total>0"
    :total="total"
    :page.sync="queryParams.pageNum"
    :limit.sync="queryParams.pageSize"
    @pagination="getList"
  />
  </div>
</template>

<script>
    import {listMail} from "../../../api/mail/mail";

    export default {
        data() {
            return {
                loading: true,
                mailRecordList:[],
                total: 0,
                queryParams: {
                    pageNum: 1,
                    pageSize: 10,
                    sendAddress:undefined,
                    receiveAddress:undefined,
                    mailTitle:undefined,
                    sendTime:undefined
                }
            }
        },
        created() {
            this.getList();
        },
        methods: {
            getList(){
                this.loading = true;
                listMail(this.queryParams).then(response => {
                    this.mailRecordList = response.rows;
                    this.total = response.total;
                    this.loading = false;
                })
            },
        }
    }
</script>
